/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package UTILS;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Hàm cung cấp các phương thức kiểm định
 * @author HuuTri
 */
public class Validator {
    private static String PATTERN_EMAIL = "^[\\w]+(\\.[\\w]+)*([\\w-][\\w]+)*@"
                                    + "[\\w]+(\\.[\\w]+)*(\\.[A-Za-z]{2,})$";
    
    /**
     * Kiểm tra tiêu chuẩn email
     * @param email
     * @return 
     */
    public static boolean validateEmail(String email) {        
        Pattern pattern = Pattern.compile(PATTERN_EMAIL);
        Matcher matcher = pattern.matcher(email);
        
        return matcher.matches();
    }    
}
